import 'package:flutter/material.dart';

class SelectableButton extends StatefulWidget {
  final String name;

  SelectableButton(this.name);

  @override
  _SelectableButtonState createState() => _SelectableButtonState();
}

class _SelectableButtonState extends State<SelectableButton> {
  bool _isSelected = false;

  void _toggleSelection() {
    setState(() {
      _isSelected = !_isSelected;
    });
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: _toggleSelection,
      child: Container(
        padding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
        decoration: BoxDecoration(
          color: _isSelected ? Colors.blue[50] : Colors.grey[50],
          borderRadius: BorderRadius.circular(4.0),
          border: Border.fromBorderSide(_isSelected ?BorderSide(color: Colors.blue,style: BorderStyle.solid) :BorderSide.none),
        ),
        child: Text(
          _isSelected ? widget.name : widget.name ,
          style: TextStyle(color: Colors.grey),
        ),
      ),
    );
  }
}